home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 676-700 / 681 / term / source.lha / DPrintf.asm < prev    next >
Assembly Source File  |  1992-05-09  |  2KB  |  86 lines

  1. * $Revision Header * Header built automatically - do not edit! *************
  2. *
  3. *    (C) Copyright 1991 by Olaf 'Olsen' Barthel & MXM
  4. *
  5. *    Name .....: DPrintf.asm
  6. *    Created ..: Thursday 19-Sep-91 17:49
  7. *    Revision .: 1
  8. *
  9. *    Date            Author          Comment
  10. *    =========       ========        ====================
  11. *    19-Sep-91       Olsen           Created this file!
  12. *
  13. * $Revision Header *********************************************************
  14.  
  15.     include    "exec/types.i"
  16.     include    "exec/ports.i"
  17.     include    "exec/memory.i"
  18.  
  19. CALL    macro
  20.     xref    _LVO\1
  21.     jsr    _LVO\1(a6)
  22.     endm
  23.  
  24. Args    equ    5*4+4
  25. VarArgs    equ    Args+4
  26.  
  27.     csect    text,0,0,1,2
  28.  
  29. *--------------------------------------------------------------------------
  30. *
  31. *    This file replaces a bunch of routines originally residing
  32. *    in termInit.c, note that the following routine interfaces
  33. *    to a tool called `FarPortII' which is not included with the
  34. *    `term' distribution.
  35. *
  36. *--------------------------------------------------------------------------
  37.  
  38.     xdef    _DPrintf
  39.  
  40. _DPrintf:
  41.     movem.l    a2-a6,-(sp)
  42.  
  43.     move.l    4,a6
  44.  
  45.     lea    PortName(pc),a1            ; FindPort("FarPort")
  46.     CALL    FindPort
  47.     tst.l    d0                ; Success?
  48.     beq    exit
  49.  
  50.     move.l    d0,a4                ; Save port address
  51.  
  52.     move.l    #MN_SIZE+256,d0            ; Allocate message body
  53.     move.l    #MEMF_PUBLIC+MEMF_CLEAR,d1
  54.     CALL    AllocMem
  55.  
  56.     tst.l    d0                ; Success
  57.     beq    exit
  58.  
  59.     move.l    d0,a5                ; Save message
  60.     move.w    #MN_SIZE+256,MN_LENGTH(a5)    ; Fill in message data
  61.     add.w    #MN_SIZE,d0
  62.     move.l    d0,LN_NAME(a5)            ; Fill in the name
  63.     move.l    d0,a3                ; Set up for sprintf call
  64.     move.l    Args(sp),a0
  65.     lea    VarArgs(sp),a1
  66.     lea    stuffchar(pc),a2
  67.  
  68.     CALL    RawDoFmt
  69.  
  70.     move.l    a4,a0                ; Get back port
  71.     move.l    a5,a1                ; Get back message
  72.  
  73.     CALL    PutMsg                ; And post it...
  74.  
  75. exit    movem.l    (sp)+,a2-a6
  76.     rts
  77.  
  78. stuffchar:
  79.     move.b    d0,(a3)+
  80.     rts
  81.  
  82. PortName:
  83.     dc.b    'FarPort',0
  84.  
  85.     end
  86.